package com.lei.design.command;

import com.lei.design.command.garagedoor.GarageDoor;
import com.lei.design.command.garagedoor.GarageDoorCloseCommand;
import com.lei.design.command.garagedoor.GarageDoorOpenCommand;
import com.lei.design.command.light.Light;
import com.lei.design.command.light.LightOffCommand;
import com.lei.design.command.light.LightOnCommand;

/**
 * @Author LeiXiaoLei
 * @Date 2022/5/20 10:51
 * @Version 1.0
 */
public class RemoteLoader {
    public static void main(String[] args) {
        RemoteControl remoteControl = new RemoteControl();
        Light kitchenLight = new Light("Kitchen");
        Light livingRoomLight = new Light("Living Room");
        GarageDoor garageDoor = new GarageDoor("");
        LightOnCommand livingRoomLightOnCommand = new LightOnCommand(livingRoomLight);
        LightOffCommand livingRoomLightOffCommand = new LightOffCommand(livingRoomLight);
        LightOnCommand kitchenLightOnCommand = new LightOnCommand(kitchenLight);
        LightOffCommand kitchenLightOffCommand = new LightOffCommand(kitchenLight);
        GarageDoorOpenCommand garageDoorOpenCommand = new GarageDoorOpenCommand(garageDoor);
        GarageDoorCloseCommand garageDoorCloseCommand = new GarageDoorCloseCommand(garageDoor);
        remoteControl.setCommand(0, livingRoomLightOnCommand, livingRoomLightOffCommand);
        remoteControl.setCommand(1, kitchenLightOnCommand, kitchenLightOffCommand);
        remoteControl.setCommand(2, garageDoorOpenCommand, garageDoorCloseCommand);

        remoteControl.OnButtonWasPushed(0);
        remoteControl.undoButtonWasPushed();
        remoteControl.OnButtonWasPushed(1);
        remoteControl.OnButtonWasPushed(2);
        remoteControl.undoButtonWasPushed();
    }
}
